package com.mediacloud.app.newsmodule.view

import android.app.Dialog
import android.content.Context
import android.view.WindowManager
import com.mediacloud.app.newsmodule.R
import kotlinx.android.synthetic.main.bigimg_touchtip.*
import org.jetbrains.anko.defaultSharedPreferences

class BigImageFlingTouchTips(context:Context): Dialog(context, R.style.ProgressDialogStyle)
{
    companion object
    {
        const val FLAG="BigImageFlingTouchTips"

        @JvmStatic
        fun isFirstOpen(context: Context):Boolean
        {
            return context.defaultSharedPreferences.getBoolean(FLAG,true)
        }
    }
    init
    {
        setContentView(R.layout.bigimg_touchtip)
        val lp = window!!.attributes
        lp.width = WindowManager.LayoutParams.MATCH_PARENT
        lp.height = WindowManager.LayoutParams.MATCH_PARENT
        window!!.attributes = lp
        close.setOnClickListener {
            context.defaultSharedPreferences.edit().putBoolean(FLAG,false).commit()
            dismiss()
        }
    }
}